package com.juzi.构造器;

/**
    目标：认识构造器 明白两种类型的 构造器的作用
 */
public class Test {
    public static void main(String[] args) {
        //通过调用构造器得到对象
        Car c = new Car();
        c.name= "宝马";
        c.price = 18.8;
        System.out.println(c.name);
        System.out.println(c.price);

        //调用有参数构造器
        Car c2 = new Car("奔驰",18.8);
        System.out.println(c2.name);
        System.out.println(c2.price);

        System.out.println(c);
        System.out.println(c2);

    }
}
